﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ManagedWifi;

namespace ManagedWifiTest
{
    class Program
    {
        static void Main(string[] args)
        {
            //using (var context = new ManagedWifiContext(ManagedWifiContext.NWlanVersion.WindowsXP))
            //{
            //    var a = context.IsDisposed;

            //    foreach (var iface in context.Interfaces)
            //    {
            //            Console.WriteLine("Interface:");
            //            Console.WriteLine("\tDescription: {0}",iface.Description);
            //            Console.WriteLine("\tState: {0}",iface.State.ToString());
            //            Console.WriteLine("\tGUID: {0}",iface.Guid.ToString());

            //            foreach (var network in context.GetAvailableNetworks(iface))
            //            {
            //                Console.WriteLine("\t\tNetwork: {0} - {1}/100",network.SSID,network.SignalStrength);
            //            }

            //        Console.ReadKey();
            //    }
            //}

            var context_wifi = new ManagedWifiContext(ManagedWifiContext.NWlanVersion.WindowsXP);

            var context = new NDISManagedWifiContext();

            context.GetAvailableNetworks(context_wifi.Interfaces.ToList()[0]);


            foreach (var iface in context_wifi.Interfaces)
            {
                Console.WriteLine("Interface:");
                Console.WriteLine("\tDescription: {0}", iface.Description);
                Console.WriteLine("\tState: {0}", iface.State.ToString());
                Console.WriteLine("\tGUID: {0}", iface.Guid.ToString());

                foreach (var network in context_wifi.GetAvailableNetworks(iface))
                {
                    foreach (var bssid in network.BSSIDs)
                    {
                        Console.WriteLine("\t\tBSSID {0}", bssid);   
                    }
                    Console.WriteLine("\t\tNetwork: {0} - {1}/100", network.SSID, network.SignalStrength);
                }

                Console.ReadKey();
            }

            Console.ReadKey();
        }
    }
}
